home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Magazine / Online / MagPLIP / Linux / plip.c < prev    next >
C/C++ Source or Header  |  1997-12-30  |  30KB  |  1,218 lines

  1. /* $Id: plip.c,v 1.16 1996-04-06 15:36:57+09 gniibe Exp $ */
  2. /* PLIP: A parallel port "network" driver for Linux. */
  3. /* This driver is for parallel port with 5-bit cable (LapLink (R) cable). */
  4. /*
  5.  * Authors:    Donald Becker,  <becker@super.org>
  6.  *        Tommy Thorn, <thorn@daimi.aau.dk>
  7.  *        Tanabe Hiroyasu, <hiro@sanpo.t.u-tokyo.ac.jp>
  8.  *        Alan Cox, <gw4pts@gw4pts.ampr.org>
  9.  *        Peter Bauer, <100136.3530@compuserve.com>
  10.  *        Niibe Yutaka, <gniibe@mri.co.jp>
  11.  *
  12.  *        Modularization and ifreq/ifmap support by Alan Cox.
  13.  *        Rewritten by Niibe Yutaka.
  14.  *
  15.  * Fixes:
  16.  *        9-Sep-95 Philip Blundell <pjb27@cam.ac.uk>
  17.  *          - only claim 3 bytes of I/O space for port at 0x3bc
  18.  *          - treat NULL return from register_netdev() as success in
  19.  *            init_module()
  20.  *          - added message if driver loaded as a module but no
  21.  *            interfaces present.
  22.  *          - release claimed I/O ports if malloc() fails during init.
  23.  *        
  24.  *        Niibe Yutaka
  25.  *          - Module initialization.  You can specify I/O addr and IRQ:
  26.  *            # insmod plip.o io=0x3bc irq=7
  27.  *          - MTU fix.
  28.  *          - Make sure other end is OK, before sending a packet.
  29.  *          - Fix immediate timer problem.
  30.  *
  31.  *        This program is free software; you can redistribute it and/or
  32.  *        modify it under the terms of the GNU General Public License
  33.  *        as published by the Free Software Foundation; either version
  34.  *        2 of the License, or (at your option) any later version.
  35.  */
  36.  
  37. /*
  38.  * Original version and the name 'PLIP' from Donald Becker <becker@super.org>
  39.  * inspired by Russ Nelson's parallel port packet driver.
  40.  *
  41.  * NOTE:
  42.  *     Tanabe Hiroyasu had changed the protocol, and it was in Linux v1.0.
  43.  *     Because of the necessity to communicate to DOS machines with the
  44.  *     Crynwr packet driver, Peter Bauer changed the protocol again
  45.  *     back to original protocol.
  46.  *
  47.  *     This version follows original PLIP protocol. 
  48.  *     So, this PLIP can't communicate the PLIP of Linux v1.0.
  49.  */
  50.  
  51. /*
  52.  *     To use with DOS box, please do (Turn on ARP switch):
  53.  *    # ifconfig plip[0-2] arp
  54.  */
  55. static const char *version = "NET3 PLIP version 2.2 (Amiga version) Stephane.Zermatten@earthling.net\n";
  56.  
  57. /*
  58.   Sources:
  59.     Ideas and protocols came from Russ Nelson's <nelson@crynwr.com>
  60.     "parallel.asm" parallel port packet driver.
  61.  
  62.   The "Crynwr" parallel port standard specifies the following protocol:
  63.     Trigger by sending '0x08' (this cause interrupt on other end)
  64.     count-low octet
  65.     count-high octet
  66.     ... data octets
  67.     checksum octet
  68.   Each octet is sent as <wait for rx. '0x1?'> <send 0x10+(octet&0x0F)>
  69.             <wait for rx. '0x0?'> <send 0x00+((octet>>4)&0x0F)>
  70.  
  71.   The packet is encapsulated as if it were ethernet.
  72.  
  73.   The cable used is a de facto standard parallel null cable -- sold as
  74.   a "LapLink" cable by various places.  You'll need a 12-conductor cable to
  75.   make one yourself.  The wiring is:
  76.     SLCTIN    17 - 17
  77.     GROUND    25 - 25
  78.     D0->ERROR    2 - 15        15 - 2
  79.     D1->SLCT    3 - 13        13 - 3
  80.     D2->PAPOUT    4 - 12        12 - 4
  81.     D3->ACK    5 - 10        10 - 5
  82.     D4->BUSY    6 - 11        11 - 6
  83.   Do not connect the other pins.  They are
  84.     D5,D6,D7 are 7,8,9
  85.     STROBE is 1, FEED is 14, INIT is 16
  86.     extra grounds are 18,19,20,21,22,23,24
  87. */
  88.  
  89. #include <linux/module.h>
  90.  
  91. #include <linux/kernel.h>
  92. #include <linux/sched.h>
  93. #include <linux/types.h>
  94. #include <linux/fcntl.h>
  95. #include <linux/interrupt.h>
  96. #include <linux/string.h>
  97. #include <linux/ptrace.h>
  98. #include <linux/if_ether.h>
  99. #include <asm/system.h>
  100. #include <asm/io.h>
  101. #include <linux/in.h>
  102. #include <linux/errno.h>
  103. #include <linux/delay.h>
  104. #include <linux/lp.h>
  105.  
  106. #include <linux/netdevice.h>
  107. #include <linux/etherdevice.h>
  108. #include <linux/skbuff.h>
  109. #include <linux/if_plip.h>
  110.  
  111. #include <linux/tqueue.h>
  112. #include <linux/ioport.h>
  113. #include <asm/bitops.h>
  114. #include <asm/irq.h>
  115. #include <asm/byteorder.h>
  116.  
  117. /* Use 0 for production, 1 for verification, >2 for debug */
  118. #ifndef NET_DEBUG
  119. #define NET_DEBUG 0
  120. #endif
  121. static unsigned int net_debug = NET_DEBUG;
  122.  
  123. /* In micro second */
  124. #define PLIP_DELAY_UNIT           3
  125.  
  126. /* Connection time out = PLIP_TRIGGER_WAIT * PLIP_DELAY_UNIT usec */
  127. #define PLIP_TRIGGER_WAIT     500
  128.  
  129. /* Nibble time out = PLIP_NIBBLE_WAIT * PLIP_DELAY_UNIT usec */
  130. #define PLIP_NIBBLE_WAIT        2000 /* 1000 */
  131.  
  132. #define PAR_INTR_ON        (LP_PINITP|LP_PSELECP|LP_PINTEN)
  133. #define PAR_INTR_OFF        (LP_PINITP|LP_PSELECP)
  134. #define PAR_DATA(dev)        ((dev)->base_addr+0)
  135. #define PAR_STATUS(dev)        ((dev)->base_addr+1)
  136. #define PAR_CONTROL(dev)    ((dev)->base_addr+2)
  137.  
  138. #define SEND_ACK(val, data_addr) do{outb(0x08|(val), data_addr); udelay(2); outb((val), data_addr);}while(0)
  139.  
  140. /* Bottom halfs */
  141. static void plip_kick_bh(struct device *dev);
  142. static void plip_bh(struct device *dev);
  143.  
  144. /* Interrupt handler */
  145. static void plip_interrupt(int irq, void *dev_id, struct pt_regs *regs);
  146.  
  147. /* Functions for DEV methods */
  148. static int plip_rebuild_header(void *buff, struct device *dev,
  149.                    unsigned long raddr, struct sk_buff *skb);
  150. static int plip_tx_packet(struct sk_buff *skb, struct device *dev);
  151. static int plip_open(struct device *dev);
  152. static int plip_close(struct device *dev);
  153. static struct enet_statistics *plip_get_stats(struct device *dev);
  154. static int plip_config(struct device *dev, struct ifmap *map);
  155. static int plip_ioctl(struct device *dev, struct ifreq *ifr, int cmd);
  156.  
  157. enum plip_connection_state {
  158.     PLIP_CN_NONE=0,
  159.     PLIP_CN_RECEIVE,
  160.     PLIP_CN_SEND,
  161.     PLIP_CN_CLOSING,
  162.     PLIP_CN_ERROR
  163. };
  164.  
  165. enum plip_packet_state {
  166.     PLIP_PK_DONE=0,
  167.     PLIP_PK_TRIGGER,
  168.     PLIP_PK_LENGTH_LSB,
  169.     PLIP_PK_LENGTH_MSB,
  170.     PLIP_PK_DATA,
  171.     PLIP_PK_CHECKSUM
  172. };
  173.  
  174. enum plip_nibble_state {
  175.     PLIP_NB_BEGIN=0,
  176.     PLIP_NB_1,
  177.     PLIP_NB_2,
  178.     PLIP_NB_3       /* send mode 0 noerrline */
  179. };
  180.  
  181. struct plip_local {
  182.     enum plip_packet_state state;
  183.     enum plip_nibble_state nibble;
  184.     union {
  185.         struct {
  186. #if defined(__LITTLE_ENDIAN)
  187.             unsigned char lsb;
  188.             unsigned char msb;
  189. #elif defined(__BIG_ENDIAN)
  190.             unsigned char msb;
  191.             unsigned char lsb;
  192. #else
  193. #error    "Please fix the endianness defines in <asm/byteorder.h>"
  194. #endif                        
  195.         } b;
  196.         unsigned short h;
  197.     } length;
  198.     unsigned short byte;
  199.     unsigned char  checksum;
  200.     unsigned char  data;
  201.     unsigned char  linestate; /* Used for sending bytes */
  202.     struct sk_buff *skb;
  203. };
  204.  
  205. struct net_local {
  206.     struct enet_statistics enet_stats;
  207.     struct tq_struct immediate;
  208.     struct tq_struct deferred;
  209.     struct plip_local snd_data;
  210.     struct plip_local rcv_data;
  211.     unsigned long  trigger;
  212.     unsigned long  nibble;
  213.     enum plip_connection_state connection;
  214.     unsigned short timeout_count;
  215.     char is_deferred;
  216.     int (*orig_rebuild_header)(void *eth, struct device *dev,
  217.                    unsigned long raddr, struct sk_buff *skb);
  218. };
  219.  
  220. /* Entry point of PLIP driver.
  221.    Probe the hardware, and register/initialize the driver. */
  222. int
  223. plip_init(struct device *dev)
  224. {
  225.     struct net_local *nl;
  226.     int iosize = (PAR_DATA(dev) == 0x3bc) ? 3 : 8;
  227.  
  228.     /* Check region before the probe */
  229.     if (check_region(PAR_DATA(dev), iosize) < 0)
  230.         return -ENODEV;
  231.  
  232.     /* Check that there is something at base_addr. */
  233.     outb(0, PAR_DATA(dev));
  234.     udelay(1000);
  235.     if (inb(PAR_DATA(dev)) != 0)
  236.         return -ENODEV;
  237.  
  238.     printk(version);
  239.     printk("%s: Parallel port at %#3lx, ", dev->name, dev->base_addr);
  240.     if (dev->irq) {
  241.         printk("using assigned IRQ %d.\n", dev->irq);
  242.     } else {
  243.         int irq = 0;
  244. #ifdef MODULE
  245.         /* dev->irq==0 means autoprobe, but we don't try to do so
  246.            with module.  We can change it by ifconfig */
  247. #else
  248.         unsigned int irqs = probe_irq_on();
  249.  
  250.         outb(0x00, PAR_CONTROL(dev));
  251.         udelay(1000);
  252.         outb(PAR_INTR_OFF, PAR_CONTROL(dev));
  253.         outb(PAR_INTR_ON, PAR_CONTROL(dev));
  254.         outb(PAR_INTR_OFF, PAR_CONTROL(dev));
  255.         udelay(1000);
  256.         irq = probe_irq_off(irqs);
  257. #endif
  258.         if (irq > 0) {
  259.             dev->irq = irq;
  260.             printk("using probed IRQ %d.\n", dev->irq);
  261.         } else
  262.             printk("failed to detect IRQ(%d) --"
  263.                    " Please set IRQ by ifconfig.\n", irq);
  264.     }
  265.  
  266.     request_region(PAR_DATA(dev), iosize, dev->name);
  267.  
  268.     /* Fill in the generic fields of the device structure. */
  269.     ether_setup(dev);
  270.  
  271.     /* Then, override parts of it */
  272.     dev->hard_start_xmit    = plip_tx_packet;
  273.     dev->open        = plip_open;
  274.     dev->stop        = plip_close;
  275.     dev->get_stats         = plip_get_stats;
  276.     dev->set_config        = plip_config;
  277.     dev->do_ioctl        = plip_ioctl;
  278.     dev->tx_queue_len    = 10;
  279.     dev->flags            = IFF_POINTOPOINT|IFF_NOARP;
  280.  
  281.     /* Set the private structure */
  282.     dev->priv = kmalloc(sizeof (struct net_local), GFP_KERNEL);
  283.     if (dev->priv == NULL) {
  284.         printk(KERN_ERR "%s: out of memory\n", dev->name);
  285.         release_region(PAR_DATA(dev), iosize);
  286.         return -ENOMEM;
  287.     }
  288.     memset(dev->priv, 0, sizeof(struct net_local));
  289.     nl = (struct net_local *) dev->priv;
  290.  
  291.     nl->orig_rebuild_header = dev->rebuild_header;
  292.     dev->rebuild_header     = plip_rebuild_header;
  293.  
  294.     /* Initialize constants */
  295.     nl->trigger    = PLIP_TRIGGER_WAIT;
  296.     nl->nibble    = PLIP_NIBBLE_WAIT;
  297.  
  298.     /* Initialize task queue structures */
  299.     nl->immediate.next = NULL;
  300.     nl->immediate.sync = 0;
  301.     nl->immediate.routine = (void *)(void *)plip_bh;
  302.     nl->immediate.data = dev;
  303.  
  304.     nl->deferred.next = NULL;
  305.     nl->deferred.sync = 0;
  306.     nl->deferred.routine = (void *)(void *)plip_kick_bh;
  307.     nl->deferred.data = dev;
  308.  
  309.     return 0;
  310. }
  311.  
  312. /* Bottom half handler for the delayed request.
  313.    This routine is kicked by do_timer().
  314.    Request `plip_bh' to be invoked. */
  315. static void
  316. plip_kick_bh(struct device *dev)
  317. {
  318.     struct net_local *nl = (struct net_local *)dev->priv;
  319.  
  320.     if (nl->is_deferred) {
  321.         queue_task(&nl->immediate, &tq_immediate);
  322.         mark_bh(IMMEDIATE_BH);
  323.     }
  324. }
  325.  
  326. /* Forward declarations of internal routines */
  327. static int plip_none(struct device *, struct net_local *,
  328.              struct plip_local *, struct plip_local *);
  329. static int plip_receive_packet(struct device *, struct net_local *,
  330.                    struct plip_local *, struct plip_local *);
  331. static int plip_send_packet(struct device *, struct net_local *,
  332.                 struct plip_local *, struct plip_local *);
  333. static int plip_connection_close(struct device *, struct net_local *,
  334.                  struct plip_local *, struct plip_local *);
  335. static int plip_error(struct device *, struct net_local *,
  336.               struct plip_local *, struct plip_local *);
  337. static int plip_bh_timeout_error(struct device *dev, struct net_local *nl,
  338.                  struct plip_local *snd,
  339.                  struct plip_local *rcv,
  340.                  int error);
  341.  
  342. #define OK        0
  343. #define TIMEOUT   1
  344. #define ERROR     2
  345.  
  346. typedef int (*plip_func)(struct device *dev, struct net_local *nl,
  347.              struct plip_local *snd, struct plip_local *rcv);
  348.  
  349. static plip_func connection_state_table[] =
  350. {
  351.     plip_none,
  352.     plip_receive_packet,
  353.     plip_send_packet,
  354.     plip_connection_close,
  355.     plip_error
  356. };
  357.  
  358. /* Bottom half handler of PLIP. */
  359. static void
  360. plip_bh(struct device *dev)
  361. {
  362.     struct net_local *nl = (struct net_local *)dev->priv;
  363.     struct plip_local *snd = &nl->snd_data;
  364.     struct plip_local *rcv = &nl->rcv_data;
  365.     plip_func f;
  366.     int r;
  367.  
  368.     nl->is_deferred = 0;
  369.     f = connection_state_table[nl->connection];
  370.     if ((r = (*f)(dev, nl, snd, rcv)) != OK
  371.         && (r = plip_bh_timeout_error(dev, nl, snd, rcv, r)) != OK) {
  372.         nl->is_deferred = 1;
  373.         queue_task(&nl->deferred, &tq_timer);
  374.     }
  375. }
  376.  
  377. static int
  378. plip_bh_timeout_error(struct device *dev, struct net_local *nl,
  379.               struct plip_local *snd, struct plip_local *rcv,
  380.               int error)
  381. {
  382.     unsigned char c0;
  383.  
  384.     cli();
  385.     if (nl->connection == PLIP_CN_SEND) {
  386.  
  387.         if (error != ERROR) { /* Timeout */
  388.             nl->timeout_count++;
  389.             if ((snd->state == PLIP_PK_TRIGGER
  390.                  && nl->timeout_count <= 10)
  391.                 || nl->timeout_count <= 3) {
  392.                 sti();
  393.                 /* Try again later */
  394.                 return TIMEOUT;
  395.             }
  396.             c0 = inb(PAR_STATUS(dev));
  397.             printk("%s: transmit timeout(%d,%02x)\n",
  398.                    dev->name, snd->state, c0);
  399.         }
  400.         nl->enet_stats.tx_errors++;
  401.         nl->enet_stats.tx_aborted_errors++;
  402.     } else if (nl->connection == PLIP_CN_RECEIVE) {
  403.         if (rcv->state == PLIP_PK_TRIGGER) {
  404.             /* Transmission was interrupted. */
  405.             sti();
  406.             return OK;
  407.         }
  408.         if (error != ERROR) { /* Timeout */
  409.             if (++nl->timeout_count <= 3) {
  410.                 sti();
  411.                 /* Try again later */
  412.                 return TIMEOUT;
  413.             }
  414.             c0 = inb(PAR_STATUS(dev));
  415.             printk("%s: receive timeout(%d,%02x)\n",
  416.                    dev->name, rcv->state, c0);
  417.         }
  418.         nl->enet_stats.rx_dropped++;
  419.     }
  420.     rcv->state = PLIP_PK_DONE;
  421.     if (rcv->skb) {
  422.         rcv->skb->free = 1;
  423.         kfree_skb(rcv->skb, FREE_READ);
  424.         rcv->skb = NULL;
  425.     }
  426.     snd->state = PLIP_PK_DONE;
  427.     if (snd->skb) {
  428.         dev_kfree_skb(snd->skb, FREE_WRITE);
  429.         snd->skb = NULL;
  430.     }
  431.     disable_irq(dev->irq);
  432.     outb(PAR_INTR_OFF, PAR_CONTROL(dev));
  433.     dev->tbusy = 1;
  434.     nl->connection = PLIP_CN_ERROR;
  435.     outb(0x00, PAR_DATA(dev));
  436.     sti();
  437.  
  438.     return TIMEOUT;
  439. }
  440.  
  441. static int
  442. plip_none(struct device *dev, struct net_local *nl,
  443.       struct plip_local *snd, struct plip_local *rcv)
  444. {
  445.     return OK;
  446. }
  447.  
  448. /* PLIP_RECEIVE --- receive a byte(two nibbles)
  449.    Returns OK on success, TIMEOUT on timeout */
  450. inline static int
  451. plip_receive(unsigned short nibble_timeout, unsigned short status_addr,
  452.          enum plip_nibble_state *ns_p, unsigned char *data_p)
  453. {
  454.     unsigned char c0, c1;
  455.     unsigned int cx;
  456.  
  457.     switch (*ns_p) {
  458.     case PLIP_NB_BEGIN:
  459.         cx = nibble_timeout;
  460.         while (1) {
  461.             c0 = inb(status_addr);
  462.             udelay(PLIP_DELAY_UNIT);
  463.             if ((c0 & 0x80) == 0) {
  464.                 c1 = inb(status_addr);
  465.                 if (c0 == c1)
  466.                     break;
  467.             }
  468.             if (--cx == 0)
  469.                 return TIMEOUT;
  470.         }
  471.         *data_p = (c0 >> 3) & 0x0f;
  472.         outb(0x10, --status_addr); /* send ACK */
  473.         status_addr++;
  474.                *ns_p = PLIP_NB_1;
  475.         
  476.     case PLIP_NB_1:
  477.         cx = nibble_timeout;
  478.         while (1) {
  479.             c0 = inb(status_addr);
  480.             udelay(PLIP_DELAY_UNIT);
  481.             if (c0 & 0x80) {
  482.                 c1 = inb(status_addr);
  483.                 if (c0 == c1)
  484.                     break;
  485.             }
  486.             if (--cx == 0)
  487.                 return TIMEOUT;
  488.         }
  489.         *data_p |= (c0 << 1) & 0xf0;
  490.         outb(0x00, --status_addr); /* send ACK */
  491.         status_addr++;
  492.         *ns_p = PLIP_NB_BEGIN;
  493.     case PLIP_NB_2:
  494.     default: /* To disable a stupid warning about PLIP_NB_3 */
  495.             
  496.         break;
  497.     }
  498.     return OK;
  499. }
  500.  
  501. /* PLIP_RECEIVE_PACKET --- receive a packet */
  502. static int
  503. plip_receive_packet(struct device *dev, struct net_local *nl,
  504.             struct plip_local *snd, struct plip_local *rcv)
  505. {
  506.     unsigned short status_addr = PAR_STATUS(dev);
  507.     unsigned short nibble_timeout = nl->nibble;
  508.     unsigned char *lbuf;
  509.  
  510.     switch (rcv->state) {
  511.     case PLIP_PK_TRIGGER:
  512.         disable_irq(dev->irq);
  513.         outb(PAR_INTR_OFF, PAR_CONTROL(dev));
  514.         dev->interrupt = 0;
  515.         outb(0x03, PAR_DATA(dev)); /* send ACK (ERROR + SELECT) */
  516.         if (net_debug > 2)
  517.             printk("%s: receive start\n", dev->name);
  518.         rcv->state = PLIP_PK_LENGTH_LSB;
  519.         rcv->nibble = PLIP_NB_BEGIN;
  520.  
  521.     case PLIP_PK_LENGTH_LSB:
  522.         if (snd->state != PLIP_PK_DONE) {
  523.             if (plip_receive(nl->trigger, status_addr,
  524.                      &rcv->nibble, &rcv->length.b.lsb)) {
  525.                 /* collision, here dev->tbusy == 1 */
  526.                 rcv->state = PLIP_PK_DONE;
  527.                 nl->is_deferred = 1;
  528.                 nl->connection = PLIP_CN_SEND;
  529.                 queue_task(&nl->deferred, &tq_timer);
  530.                 outb(PAR_INTR_ON, PAR_CONTROL(dev));
  531.                 enable_irq(dev->irq);
  532.                 return OK;
  533.             }
  534.         } else {
  535.             if (plip_receive(nibble_timeout, status_addr,
  536.                      &rcv->nibble, &rcv->length.b.lsb))
  537.                 return TIMEOUT;
  538.         }
  539.         rcv->state = PLIP_PK_LENGTH_MSB;
  540.  
  541.     case PLIP_PK_LENGTH_MSB:
  542.         if (plip_receive(nibble_timeout, status_addr,
  543.                  &rcv->nibble, &rcv->length.b.msb))
  544.             return TIMEOUT;
  545.         if (rcv->length.h > dev->mtu + dev->hard_header_len
  546.             || rcv->length.h < 8) {
  547.             printk("%s: bogus packet size %d.\n", dev->name, rcv->length.h);
  548.             return ERROR;
  549.         }
  550.         /* Malloc up new buffer. */
  551.         rcv->skb = dev_alloc_skb(rcv->length.h);
  552.         if (rcv->skb == NULL) {
  553.             printk("%s: Memory squeeze.\n", dev->name);
  554.             return ERROR;
  555.         }
  556.         skb_put(rcv->skb,rcv->length.h);
  557.         rcv->skb->dev = dev;
  558.         rcv->state = PLIP_PK_DATA;
  559.         rcv->byte = 0;
  560.         rcv->checksum = 0;
  561.  
  562.     case PLIP_PK_DATA:
  563.         lbuf = rcv->skb->data;
  564.         do
  565.             if (plip_receive(nibble_timeout, status_addr, 
  566.                      &rcv->nibble, &lbuf[rcv->byte]))
  567.                 return TIMEOUT;
  568.         while (++rcv->byte < rcv->length.h);
  569.         do
  570.             rcv->checksum += lbuf[--rcv->byte];
  571.         while (rcv->byte);
  572.         rcv->state = PLIP_PK_CHECKSUM;
  573.  
  574.     case PLIP_PK_CHECKSUM:
  575.         if (plip_receive(nibble_timeout, status_addr,
  576.                  &rcv->nibble, &rcv->data))
  577.             return TIMEOUT;
  578.         if (rcv->data != rcv->checksum) {
  579.             nl->enet_stats.rx_crc_errors++;
  580.             if (net_debug)
  581.               {
  582.                 printk("%s: checksum error %2.2x!=%2.2x\n", dev->name, rcv->data, rcv->checksum);
  583.                 if(net_debug>2)
  584.                   {
  585.                     int i;
  586.                     int len = rcv->length.h;
  587.                     if(len>64) len = 64;
  588.                     lbuf=rcv->skb->data;
  589.                     printk("PACKET size=%d\n", rcv->length.h);
  590.                     for(i=0; i<len; i++)
  591.                       {
  592.                     printk("%2.2x", lbuf[i]);
  593.                     if((i%4)==3)
  594.                       {
  595.                         if((i%16)==15) printk("\n");
  596.                         else printk(" ");
  597.                       }
  598.                       }
  599.                     if(len<rcv->length.h) printk("...");
  600.                     printk("\n");
  601.                   }
  602.               }
  603.                 return ERROR;
  604.         }
  605.         rcv->state = PLIP_PK_DONE;
  606.  
  607.     case PLIP_PK_DONE:
  608.         /* Inform the upper layer for the arrival of a packet. */
  609.         rcv->skb->protocol=eth_type_trans(rcv->skb, dev);
  610.         netif_rx(rcv->skb);
  611.         nl->enet_stats.rx_packets++;
  612.         rcv->skb = NULL;
  613.         if (net_debug > 2)
  614.             printk("%s: receive end (%d bytes)\n", dev->name, rcv->length.h);
  615.  
  616.         /* Close the connection. */
  617.         outb (0x00, PAR_DATA(dev));
  618.         cli();
  619.         if (snd->state != PLIP_PK_DONE) {
  620.             nl->connection = PLIP_CN_SEND;
  621.             sti();
  622.             queue_task(&nl->immediate, &tq_immediate);
  623.             mark_bh(IMMEDIATE_BH);
  624.             outb(PAR_INTR_ON, PAR_CONTROL(dev));
  625.             enable_irq(dev->irq);
  626.             return OK;
  627.         } else {
  628.             nl->connection = PLIP_CN_NONE;
  629.             sti();
  630.             outb(PAR_INTR_ON, PAR_CONTROL(dev));
  631.             enable_irq(dev->irq);
  632.             return OK;
  633.         }
  634.     }
  635.     return OK;
  636. }
  637.  
  638.   /* Split a char in 3 parts (2*3 bits + 1*2 bits) 
  639.    *  Output : D0 = 0 D1=bit 1+3*part D2=bit 2+3*part D3=0 D4=bit 3+3*part 
  640.    *           D5-7 = 0
  641.    */
  642.   unsigned char bitpart(unsigned char data, int part)
  643.     {
  644.       unsigned char outbits = 0;
  645.       unsigned char bits = (data>>((part-1)*3))&0x07; /* The 3 bits */
  646.       if(bits&1) outbits |= 0x10;
  647.       if(bits&2) outbits |= 0x04;
  648.       if(bits&4) outbits |= 0x02;
  649.       return outbits;
  650.     }
  651.  
  652. /* PLIP_SEND --- send a byte (two nibbles) 
  653.    Returns OK on success, TIMEOUT when timeout    */
  654. inline static int
  655. plip_send(unsigned short nibble_timeout, unsigned short data_addr,
  656.       enum plip_nibble_state *ns_p, unsigned char data, unsigned char *stateptr)
  657. {
  658.  
  659.     unsigned char c0;
  660.     unsigned int cx;
  661.     unsigned char state;
  662.  
  663.     switch (*ns_p) {
  664.     case PLIP_NB_BEGIN:
  665.         SEND_ACK(bitpart(data, 1), data_addr);
  666.         *ns_p = PLIP_NB_1;
  667.  
  668.     case PLIP_NB_1:
  669.         cx = nibble_timeout;
  670.         data_addr++;
  671.         state = *stateptr;
  672.         while (1) {
  673.             c0 = inb(data_addr);
  674.             if ((c0 & 0x80) == state) 
  675.                 break;
  676.             if (--cx == 0)
  677.                 return TIMEOUT;
  678.             udelay(PLIP_DELAY_UNIT);
  679.         }
  680.         *stateptr = (state) ? 0:0x80;
  681.         --data_addr;
  682.         SEND_ACK(bitpart(data, 2), data_addr);
  683.         *ns_p = PLIP_NB_2;
  684.  
  685.     case PLIP_NB_2:
  686.         data_addr++;
  687.         cx = nibble_timeout;
  688.         state = *stateptr;
  689.         while (1) {
  690.             c0 = inb(data_addr);
  691.             if( (c0 & 0x80) == state)
  692.                 break;
  693.             if (--cx == 0)
  694.                 return TIMEOUT;
  695.             udelay(PLIP_DELAY_UNIT);
  696.         }
  697.         *stateptr = (state) ? 0:0x80;
  698.         --data_addr;
  699.         SEND_ACK(bitpart(data, 3), data_addr);
  700.         *ns_p = PLIP_NB_3;
  701.  
  702.     case PLIP_NB_3:
  703.         data_addr++;
  704.         cx = nibble_timeout;
  705.         state = *stateptr;
  706.         while(1) {
  707.           c0 = inb(data_addr);
  708.           if((c0&0x80)==state) break;
  709.           if(--cx==0) return TIMEOUT;
  710.           udelay(PLIP_DELAY_UNIT);
  711.         }
  712.             *stateptr = (state) ? 0:0x80;
  713.         --data_addr;
  714.  
  715.         *ns_p = PLIP_NB_BEGIN;
  716.         return OK;
  717.     }
  718.     return OK;
  719. }
  720.  
  721. /* PLIP_SEND_PACKET --- send a packet */
  722. static int
  723. plip_send_packet(struct device *dev, struct net_local *nl,
  724.          struct plip_local *snd, struct plip_local *rcv)
  725. {
  726.     unsigned short data_addr = PAR_DATA(dev);
  727.     unsigned short nibble_timeout = nl->nibble;
  728.     unsigned char *lbuf;
  729.     unsigned char c0;
  730.     unsigned int cx;
  731.  
  732.     if (snd->skb == NULL || (lbuf = snd->skb->data) == NULL) {
  733.         printk("%s: send skb lost\n", dev->name);
  734.         snd->state = PLIP_PK_DONE;
  735.         snd->skb = NULL;
  736.         return ERROR;
  737.     }
  738.  
  739.     switch (snd->state) {
  740.     case PLIP_PK_TRIGGER:
  741.         if ((inb(PAR_STATUS(dev)) & 0xf8) != 0x80)
  742.           {
  743.             if(net_debug>2)
  744.                 printk("%s : line not ready to send %2.2x\n", dev->name, inb(PAR_STATUS(dev))&0xf8);
  745.             return TIMEOUT;
  746.           }
  747.  
  748.         /* Trigger remote rx interrupt. */
  749.             SEND_ACK(0x04, data_addr);
  750.  
  751.         cx = nl->trigger;
  752.         while (1) {
  753.             udelay(PLIP_DELAY_UNIT);
  754.             cli();
  755.             if (nl->connection == PLIP_CN_RECEIVE) {
  756.                 sti();
  757.                 /* interrupted */
  758.                 nl->enet_stats.collisions++;
  759.                 if (net_debug > 1)
  760.                     printk("%s: collision.\n", dev->name);
  761.                 return OK;
  762.             }
  763.             c0 = inb(PAR_STATUS(dev));
  764.             if (c0 & 0x10) {
  765.                 disable_irq(dev->irq);
  766.                 outb(PAR_INTR_OFF, PAR_CONTROL(dev));
  767.                 if (net_debug > 2)
  768.                     printk("%s: send start (len = %d)\n", dev->name, snd->length.h);
  769.                 snd->state = PLIP_PK_LENGTH_LSB;
  770.                 snd->nibble = PLIP_NB_BEGIN;
  771.                 nl->timeout_count = 0;
  772.                 sti();
  773.                 break;
  774.             }
  775.             sti();
  776.             if (--cx == 0) {
  777.                 outb(0x00, data_addr);
  778.                 return TIMEOUT;
  779.             }
  780.         }
  781.  
  782.     case PLIP_PK_LENGTH_LSB:
  783.            snd->linestate = 0;
  784.         if (plip_send(nibble_timeout, data_addr,
  785.                   &snd->nibble, snd->length.b.lsb, &snd->linestate))
  786.             return TIMEOUT;
  787.         snd->state = PLIP_PK_LENGTH_MSB;
  788.  
  789.     case PLIP_PK_LENGTH_MSB:
  790.         if (plip_send(nibble_timeout, data_addr,
  791.                   &snd->nibble, snd->length.b.msb, &snd->linestate))
  792.             return TIMEOUT;
  793.         snd->state = PLIP_PK_DATA;
  794.         snd->byte = 0;
  795.         snd->checksum = 0;
  796.  
  797.     case PLIP_PK_DATA:
  798.         do
  799.             if (plip_send(nibble_timeout, data_addr,
  800.                       &snd->nibble, lbuf[snd->byte], &snd->linestate))
  801.                 return TIMEOUT;
  802.         while (++snd->byte < snd->length.h);
  803.         do
  804.             snd->checksum += lbuf[--snd->byte];
  805.         while (snd->byte);
  806.         snd->state = PLIP_PK_CHECKSUM;
  807.  
  808.     case PLIP_PK_CHECKSUM:
  809.         if (plip_send(nibble_timeout, data_addr,
  810.                   &snd->nibble, snd->checksum, &snd->linestate))
  811.             return TIMEOUT;
  812.  
  813.         dev_kfree_skb(snd->skb, FREE_WRITE);
  814.         nl->enet_stats.tx_packets++;
  815.         snd->state = PLIP_PK_DONE;
  816.  
  817.     case PLIP_PK_DONE:
  818.            if(snd->linestate!=0)
  819.          SEND_ACK(0x00, data_addr);
  820.            else
  821.          outb (0x00, data_addr);
  822.         snd->skb = NULL;
  823.         if (net_debug > 2)
  824.             printk("%s: send end\n", dev->name);
  825.  
  826.         nl->connection = PLIP_CN_CLOSING;
  827.         nl->is_deferred = 1;
  828.         queue_task(&nl->deferred, &tq_timer);
  829.         outb(PAR_INTR_ON, PAR_CONTROL(dev));
  830.         enable_irq(dev->irq);
  831.         return OK;
  832.     }
  833.     return OK;
  834. }
  835.  
  836. static int
  837. plip_connection_close(struct device *dev, struct net_local *nl,
  838.               struct plip_local *snd, struct plip_local *rcv)
  839. {
  840.     cli();
  841.     if (nl->connection == PLIP_CN_CLOSING) {
  842.         nl->connection = PLIP_CN_NONE;
  843.         dev->tbusy = 0;
  844.         mark_bh(NET_BH);
  845.     }
  846.     sti();
  847.     return OK;
  848. }
  849.  
  850. /* PLIP_ERROR --- wait till other end settled */
  851. static int
  852. plip_error(struct device *dev, struct net_local *nl,
  853.        struct plip_local *snd, struct plip_local *rcv)
  854. {
  855.     unsigned char status;
  856.  
  857.     status = inb(PAR_STATUS(dev));
  858.     if ((status & 0xf8) == 0x80) {
  859.         if (net_debug > 2)
  860.             printk("%s: reset interface.\n", dev->name);
  861.         nl->connection = PLIP_CN_NONE;
  862.         dev->tbusy = 0;
  863.         dev->interrupt = 0;
  864.         outb(PAR_INTR_ON, PAR_CONTROL(dev));
  865.         enable_irq(dev->irq);
  866.         mark_bh(NET_BH);
  867.     } else {
  868.         nl->is_deferred = 1;
  869.         queue_task(&nl->deferred, &tq_timer);
  870.     }
  871.  
  872.     return OK;
  873. }
  874.  
  875. /* Handle the parallel port interrupts. */
  876. static void
  877. plip_interrupt(int irq, void *dev_id, struct pt_regs * regs)
  878. {
  879.     struct device *dev = (struct device *) irq2dev_map[irq];
  880.     struct net_local *nl = (struct net_local *)dev->priv;
  881.     struct plip_local *rcv = &nl->rcv_data;
  882.     unsigned char c0;
  883.  
  884.     if (dev == NULL) {
  885.         printk ("plip_interrupt: irq %d for unknown device.\n", irq);
  886.         return;
  887.     }
  888.  
  889.     if (dev->interrupt)
  890.         return;
  891.  
  892.     c0 = inb(PAR_STATUS(dev));
  893.     if ((c0 & 0xf8) != 0xc0) {
  894.         if (net_debug > 1)
  895.             printk("%s: spurious interrupt\n", dev->name);
  896.         return;
  897.     }
  898.     dev->interrupt = 1;
  899.     if (net_debug > 3)
  900.         printk("%s: interrupt.\n", dev->name);
  901.  
  902.     cli();
  903.     switch (nl->connection) {
  904.     case PLIP_CN_CLOSING:
  905.         dev->tbusy = 0;
  906.     case PLIP_CN_NONE:
  907.     case PLIP_CN_SEND:
  908.         dev->last_rx = jiffies;
  909.         rcv->state = PLIP_PK_TRIGGER;
  910.         nl->connection = PLIP_CN_RECEIVE;
  911.         nl->timeout_count = 0;
  912.         queue_task(&nl->immediate, &tq_immediate);
  913.         mark_bh(IMMEDIATE_BH);
  914.         sti();
  915.         break;
  916.  
  917.     case PLIP_CN_RECEIVE:
  918.         sti();
  919.         printk("%s: receive interrupt when receiving packet\n", dev->name);
  920.         break;
  921.  
  922.     case PLIP_CN_ERROR:
  923.         sti();
  924.         printk("%s: receive interrupt in error state\n", dev->name);
  925.         break;
  926.     }
  927. }
  928.  
  929. /* We don't need to send arp, for plip is point-to-point. */
  930. static int
  931. plip_rebuild_header(void *buff, struct device *dev, unsigned long dst,
  932.             struct sk_buff *skb)
  933. {
  934.     struct net_local *nl = (struct net_local *)dev->priv;
  935.     struct ethhdr *eth = (struct ethhdr *)buff;
  936.     int i;
  937.  
  938.     if ((dev->flags & IFF_NOARP)==0)
  939.         return nl->orig_rebuild_header(buff, dev, dst, skb);
  940.  
  941.     if (eth->h_proto != htons(ETH_P_IP)) {
  942.         printk("plip_rebuild_header: Don't know how to resolve type %d addresses?\n", (int)eth->h_proto);
  943.         memcpy(eth->h_source, dev->dev_addr, dev->addr_len);
  944.         return 0;
  945.     }
  946.  
  947.     for (i=0; i < ETH_ALEN - sizeof(u32); i++)
  948.         eth->h_dest[i] = 0xfc;
  949.     *(u32 *)(eth->h_dest+i) = dst;
  950.     return 0;
  951. }
  952.  
  953. static int
  954. plip_tx_packet(struct sk_buff *skb, struct device *dev)
  955. {
  956.     struct net_local *nl = (struct net_local *)dev->priv;
  957.     struct plip_local *snd = &nl->snd_data;
  958.  
  959.     if (dev->tbusy)
  960.         return 1;
  961.  
  962.     /* If some higher layer thinks we've missed an tx-done interrupt
  963.        we are passed NULL. Caution: dev_tint() handles the cli()/sti()
  964.        itself. */
  965.     if (skb == NULL) {
  966.         dev_tint(dev);
  967.         return 0;
  968.     }
  969.  
  970.     if (set_bit(0, (void*)&dev->tbusy) != 0) {
  971.         printk("%s: Transmitter access conflict.\n", dev->name);
  972.         return 1;
  973.     }
  974.  
  975.     if (skb->len > dev->mtu + dev->hard_header_len) {
  976.         printk("%s: packet too big, %d.\n", dev->name, (int)skb->len);
  977.         dev->tbusy = 0;
  978.         return 0;
  979.     }
  980.  
  981.     if (net_debug > 2)
  982.         printk("%s: send request\n", dev->name);
  983.  
  984.     cli();
  985.     dev->trans_start = jiffies;
  986.     snd->skb = skb;
  987.     snd->length.h = skb->len;
  988.     snd->state = PLIP_PK_TRIGGER;
  989.     if (nl->connection == PLIP_CN_NONE) {
  990.         nl->connection = PLIP_CN_SEND;
  991.         nl->timeout_count = 0;
  992.     }
  993.     queue_task(&nl->immediate, &tq_immediate);
  994.     mark_bh(IMMEDIATE_BH);
  995.     sti();
  996.  
  997.     return 0;
  998. }
  999.  
  1000. /* Open/initialize the board.  This is called (in the current kernel)
  1001.    sometime after booting when the 'ifconfig' program is run.
  1002.  
  1003.    This routine gets exclusive access to the parallel port by allocating
  1004.    its IRQ line.
  1005.  */
  1006. static int
  1007. plip_open(struct device *dev)
  1008. {
  1009.     struct net_local *nl = (struct net_local *)dev->priv;
  1010.     int i;
  1011.  
  1012.     if (dev->irq == 0) {
  1013.         printk("%s: IRQ is not set.  Please set it by ifconfig.\n", dev->name);
  1014.         return -EAGAIN;
  1015.     }
  1016.     cli();
  1017.     if (request_irq(dev->irq , plip_interrupt, 0, dev->name, NULL) != 0) {
  1018.         sti();
  1019.         printk("%s: couldn't get IRQ %d.\n", dev->name, dev->irq);
  1020.         return -EAGAIN;
  1021.     }
  1022.     irq2dev_map[dev->irq] = dev;
  1023.     sti();
  1024.  
  1025.     /* Clear the data port. */
  1026.     outb (0x00, PAR_DATA(dev));
  1027.  
  1028.     /* Enable rx interrupt. */
  1029.     outb(PAR_INTR_ON, PAR_CONTROL(dev));
  1030.  
  1031.     /* Initialize the state machine. */
  1032.     nl->rcv_data.state = nl->snd_data.state = PLIP_PK_DONE;
  1033.     nl->rcv_data.skb = nl->snd_data.skb = NULL;
  1034.     nl->connection = PLIP_CN_NONE;
  1035.     nl->is_deferred = 0;
  1036.  
  1037.     /* Fill in the MAC-level header. */
  1038.     for (i=0; i < ETH_ALEN - sizeof(u32); i++)
  1039.         dev->dev_addr[i] = 0xfc;
  1040.     *(u32 *)(dev->dev_addr+i) = dev->pa_addr;
  1041.  
  1042.     dev->interrupt = 0;
  1043.     dev->start = 1;
  1044.     dev->tbusy = 0;
  1045.     MOD_INC_USE_COUNT;
  1046.     return 0;
  1047. }
  1048.  
  1049. /* The inverse routine to plip_open (). */
  1050. static int
  1051. plip_close(struct device *dev)
  1052. {
  1053.     struct net_local *nl = (struct net_local *)dev->priv;
  1054.     struct plip_local *snd = &nl->snd_data;
  1055.     struct plip_local *rcv = &nl->rcv_data;
  1056.  
  1057.     dev->tbusy = 1;
  1058.     dev->start = 0;
  1059.     cli();
  1060.     free_irq(dev->irq, NULL);
  1061.     irq2dev_map[dev->irq] = NULL;
  1062.     nl->is_deferred = 0;
  1063.     nl->connection = PLIP_CN_NONE;
  1064.     sti();
  1065.     outb(0x00, PAR_DATA(dev));
  1066.  
  1067.     snd->state = PLIP_PK_DONE;
  1068.     if (snd->skb) {
  1069.         dev_kfree_skb(snd->skb, FREE_WRITE);
  1070.         snd->skb = NULL;
  1071.     }
  1072.     rcv->state = PLIP_PK_DONE;
  1073.     if (rcv->skb) {
  1074.         rcv->skb->free = 1;
  1075.         kfree_skb(rcv->skb, FREE_READ);
  1076.         rcv->skb = NULL;
  1077.     }
  1078.  
  1079.     /* Reset. */
  1080.     outb(0x00, PAR_CONTROL(dev));
  1081.     MOD_DEC_USE_COUNT;
  1082.     return 0;
  1083. }
  1084.  
  1085. static struct enet_statistics *
  1086. plip_get_stats(struct device *dev)
  1087. {
  1088.     struct net_local *nl = (struct net_local *)dev->priv;
  1089.     struct enet_statistics *r = &nl->enet_stats;
  1090.  
  1091.     return r;
  1092. }
  1093.  
  1094. static int
  1095. plip_config(struct device *dev, struct ifmap *map)
  1096. {
  1097.     if (dev->flags & IFF_UP)
  1098.         return -EBUSY;
  1099.  
  1100.     if (map->base_addr != (unsigned long)-1
  1101.         && map->base_addr != dev->base_addr)
  1102.         printk("%s: You cannot change base_addr of this interface (ignored).\n", dev->name);
  1103.  
  1104.     if (map->irq != (unsigned char)-1)
  1105.         dev->irq = map->irq;
  1106.     return 0;
  1107. }
  1108.  
  1109. static int
  1110. plip_ioctl(struct device *dev, struct ifreq *rq, int cmd)
  1111. {
  1112.     struct net_local *nl = (struct net_local *) dev->priv;
  1113.     struct plipconf *pc = (struct plipconf *) &rq->ifr_data;
  1114.     
  1115.     switch(pc->pcmd) {
  1116.     case PLIP_GET_TIMEOUT:
  1117.         pc->trigger = nl->trigger;
  1118.         pc->nibble  = nl->nibble;
  1119.         break;
  1120.     case PLIP_SET_TIMEOUT:
  1121.         nl->trigger = pc->trigger;
  1122.         nl->nibble  = pc->nibble;
  1123.         break;
  1124.     default:
  1125.         return -EOPNOTSUPP;
  1126.     }
  1127.     return 0;
  1128. }
  1129.  
  1130. #ifdef MODULE
  1131. static int io[] = {0, 0, 0};
  1132. static int irq[] = {0, 0, 0};
  1133.  
  1134. static struct device dev_plip[] = {
  1135.     {
  1136.         "plip0",
  1137.         0, 0, 0, 0,        /* memory */
  1138.         0x3BC, 5,        /* base, irq */
  1139.         0, 0, 0, NULL, plip_init 
  1140.     },
  1141.     {
  1142.         "plip1",
  1143.         0, 0, 0, 0,        /* memory */
  1144.         0x378, 7,        /* base, irq */
  1145.         0, 0, 0, NULL, plip_init 
  1146.     },
  1147.     {
  1148.         "plip2",
  1149.         0, 0, 0, 0,        /* memory */
  1150.         0x278, 2,        /* base, irq */
  1151.         0, 0, 0, NULL, plip_init 
  1152.     }
  1153. };
  1154.  
  1155. int
  1156. init_module(void)
  1157. {
  1158.     int no_parameters=1;
  1159.     int devices=0;
  1160.     int i;
  1161.  
  1162.     /* When user feeds parameters, use them */
  1163.     for (i=0; i < 3; i++) {
  1164.         int specified=0;
  1165.  
  1166.         if (io[i] != 0) {
  1167.             dev_plip[i].base_addr = io[i];
  1168.             specified++;
  1169.         }
  1170.         if (irq[i] != 0) {
  1171.             dev_plip[i].irq = irq[i];
  1172.             specified++;
  1173.         }
  1174.         if (specified) {
  1175.             if (register_netdev(&dev_plip[i]) != 0) {
  1176.                 printk(KERN_INFO "plip%d: Not found\n", i);
  1177.                 return -EIO;
  1178.             }
  1179.             no_parameters = 0;
  1180.         }
  1181.     }
  1182.     if (!no_parameters)
  1183.         return 0;
  1184.  
  1185.     /* No parameters.  Default action is probing all interfaces. */
  1186.     for (i=0; i < 3; i++) { 
  1187.         if (register_netdev(&dev_plip[i]) == 0)
  1188.             devices++;
  1189.     }
  1190.     if (devices == 0) {
  1191.         printk(KERN_INFO "plip: no interfaces found\n");
  1192.         return -EIO;
  1193.     }
  1194.     return 0;
  1195. }
  1196.  
  1197. void
  1198. cleanup_module(void)
  1199. {
  1200.     int i;
  1201.  
  1202.     for (i=0; i < 3; i++) {
  1203.         if (dev_plip[i].priv) {
  1204.             unregister_netdev(&dev_plip[i]);
  1205.             release_region(PAR_DATA(&dev_plip[i]), (PAR_DATA(&dev_plip[i]) == 0x3bc)? 3 : 8);
  1206.             kfree_s(dev_plip[i].priv, sizeof(struct net_local));
  1207.             dev_plip[i].priv = NULL;
  1208.         }
  1209.     }
  1210. }
  1211. #endif /* MODULE */
  1212.  
  1213. /*
  1214.  * Local variables:
  1215.  * compile-command: "gcc -DMODULE -DMODVERSIONS -D__KERNEL__ -Wall -Wstrict-prototypes -O2 -g -fomit-frame-pointer -pipe -m486 -c plip.c"
  1216.  * End:
  1217.  */
  1218.